<template>
  <svg class="icon" :class="`icon-${icon}`">
    <use :href="`${sprite}#${icon}`"></use>
  </svg>
</template>

<script>
import sprite from "~/assets/icons/sprite.svg";

export default {
  name: "TheIcon",
  props: {
    icon: {
      type: String,
      required: true
    },
    strokeWidth: {
      type: [String, Number],
      default: 2
    }
  },
  data() {
    return {
      sprite
    };
  }
};
</script>

<style scoped>
.icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
  stroke: currentColor;
  display: inline-block;
  vertical-align: middle;
  transition: stroke 0.3s ease, fill 0.3s ease;
}
</style>